//
//  BankCardListUseBttomView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/18.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "BankCardListUseBttomView.h"

@implementation BankCardListUseBttomView


- (id)initWithInSuperView:(UIView *)aSuperView
{
    if (self == [super initWithInSuperView:aSuperView]) {
        self.backgroundColor = [UIColor whiteColor];
        
        CGFloat heightV = kHeightProportion_In_iPhoneTriploid(49);
        CGRect newFrame = CGRectMake(0, KScreenHeight - heightV - kHeightProportion_In_iPhoneTriploid(24), KScreenWidth, heightV);
        self.frame = newFrame;
        
        GLGWView *topView = [[GLGWView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(1)) inSuperView:self];
        topView.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
        
        CGFloat seleBtnX = kWidthProportion_In_iPhoneTriploid(15);
        CGFloat seleBtnY = 0;
        CGFloat seleBtnW = kWidthProportion_In_iPhoneTriploid(100);
        CGFloat seleBtnH = newFrame.size.height;
        GLGWButton *seleBtn = [[GLGWButton alloc] initWithFrame:CGRectMake(seleBtnX, seleBtnY, seleBtnW, seleBtnH) inSuperView:self];
        //        [seleBtn addTarget:seleBtn action:@selector(allSelseAction:) forControlEvents:UIControlEventTouchUpInside];
        [seleBtn setImage:[UIImage imageNamed:@"goods_shoucan"] forState:UIControlStateNormal];
        [seleBtn setTitle:@"全选" forState:UIControlStateNormal];
        [seleBtn setTitleColor:kColor_Rule_Black forState:UIControlStateNormal];
        [seleBtn setImagePositionWithType:SSImagePositionTypeLeft spacing:kWidthProportion_In_iPhoneTriploid(5)];
        seleBtn.titleLabel.font = SYSTEMFONT(14);
        _seleAll = seleBtn;
        
        GLGWButton *stopBtn = [[GLGWButton alloc] initWithTitleLableFontType:SYSTEMFONT(12) titleColor:kColor_Rule_Black inSuperView:self];
        [stopBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.centerY.equalTo(seleBtn.mas_centerY);
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(48)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(18)));
        }];
        stopBtn.layer.masksToBounds = YES;
        stopBtn.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(9);
        stopBtn.layer.borderWidth = 1;
        stopBtn.layer.borderColor = [UIColor colorWithHexString:@"#EAEAEA"].CGColor;
        [stopBtn setTitle:@"停用" forState:UIControlStateNormal];
        stopBtn.tag = 655;
        [stopBtn addTarget:self action:@selector(allDeleteAction:) forControlEvents:UIControlEventTouchUpInside];
        
        GLGWButton *startBtn = [[GLGWButton alloc] initWithTitleLableFontType:SYSTEMFONT(12) titleColor:kColor_Rule_Black inSuperView:self];
        [startBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(stopBtn.mas_left).offset(-kWidthProportion_In_iPhoneTriploid(22));
            make.centerY.equalTo(seleBtn.mas_centerY);
            make.width.equalTo(stopBtn.mas_width);
            make.height.equalTo(stopBtn.mas_height);
        }];
        startBtn.layer.masksToBounds = YES;
        startBtn.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(9);
        startBtn.layer.borderWidth = 1;
        startBtn.tag = 658;
        startBtn.layer.borderColor = [UIColor colorWithHexString:@"#EAEAEA"].CGColor;
        [startBtn setTitle:@"启用" forState:UIControlStateNormal];
        [startBtn addTarget:self action:@selector(startAction:) forControlEvents:UIControlEventTouchUpInside];

    }
    return self;
}

- (void)allDeleteAction:(GLGWButton *)sender
{
    if (self.BlockAllDelete) {
        self.BlockAllDelete(sender);
    }
}
- (void)startAction:(GLGWButton *)sender
{
    if (self.BlockStart) {
        self.BlockStart(sender);
    }
}


- (void)showView
{
    [UIView animateWithDuration:0.7 animations:^{
        CGRect newFreame = self.frame;
        newFreame.origin.y -= self.frame.size.height *2;
        self.frame = newFreame;
    } completion:nil];
}

- (void)dismissView
{
    [UIView animateWithDuration:0.7 animations:^{
        CGRect newFreame = self.frame;
        newFreame.origin.y += self.frame.size.height * 2;
        self.frame = newFreame;
    } completion:nil];
}

@end
